package 线程.demo04;

/**
 * @author wql
 * @version 1.0
 * @date 2022/10/31 15:38
 */

public class Boy implements Runnable{
    private BankCard bankCard;

    public Boy(BankCard bankCard) {
        this.bankCard = bankCard;
    }

    @Override
    public void run() {
        for (int i = 0; i < 5; i++) {
            bankCard.setChanges(bankCard.getChanges()+10000);
            System.out.println(Thread.currentThread().getName()+"存了10000，余额为："+bankCard.getChanges());
        }
    }
}
